<?php $this->load->view('inc/header');?>
<div class="main-cont">

	<div class="b1"></div>

	<div class="opt-bar">
		<a href="<?php echo site_url('c=news&m=add');?>">添加新闻</a>
		<a class="btn-ajax-confirm"
			msg="sure ?" 
			befordo="news_del_befor"
			href="<?php echo site_url('c=news&m=del_batch');?>">批量删除</a>
	</div>

	<div class="b1"></div>

	<table class="tbl-list" cellpadding="0" cellspacing="0">
		<thead>
			<tr>
				<th width="20"><input class="ckb-a" type="checkbox" /></th>
				<th>新闻标题</th>
				<th width="300">类别</th>
				<th width="180">添加时间</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
			<?php foreach ($list_news as $v):?>
			<tr>
				<td>
					<input class="ckb-s" type="checkbox" value="<?php echo $v->id;?>"/>
				</td>
				<td><?php echo $v->title;?></td>
				<td><?php echo $v->cname;?></td>
				<td><?php print_date($v->atime);?></td>
				<td>
					<a class="btn-ajax-confirm" msg="确定 要删除吗?" 
						href="<?php echo site_url('c=news&m=del&id='.$v->id);?>">删除</a>
					<a href="<?php echo site_url('c=news&m=edit&id='.$v->id);?>">编辑</a>
				</td>				
			</tr>
			<?php endforeach;?>
		</tbody>
	</table>



</div>
<?php $this->load->view('inc/footer');?>

<script>$(function(){

});

function news_del_befor($elt){
	
	var arr_id = new Array();
	$('.ckb-s:checked').each(function(i,n){
		arr_id[arr_id.length] = $(n).val();
	});
	var str_ids = arr_id.join(',');	

	if(str_ids.length<=0){
	 alert('请选择节点！');
	 return false;
	}
	
	var url = $elt.attr('href');
	$elt.attr('href',url+'&ids='+str_ids)
	return true;
}

</script>